package com.yuyou.fn.tms.controller;

import com.github.wens.mybatisplus.examples.Example;
import com.yuyou.fn.common.exception.BusException;
import com.yuyou.fn.common.util.Utils;
import com.yuyou.fn.educational.entity.BaseGrade;
import com.yuyou.fn.educational.service.IBaseGradeService;
import io.swagger.annotations.ApiOperation;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.net.UnknownHostException;

/**
 * Created by wens on 2017/6/16.
 */
@Controller
public class ServerStatusController {




    @ApiOperation("监控")
    @RequestMapping(value = "/server/check", method = {RequestMethod.GET, RequestMethod.POST})
    @ResponseBody
    public String check() {
        return "ok" ;
    }

    @ApiOperation("jvm")
    @RequestMapping(value = "/server/jvm", method = {RequestMethod.GET, RequestMethod.POST})
    @ResponseBody
    public String jvm() {
        Runtime runtime = Runtime.getRuntime();
        return String.format("hostIP:%s,maxMemory:%s,totalMemory:%s,freeMemory:%s", Utils.getHostIP(),runtime.maxMemory() ,runtime.totalMemory(),runtime.freeMemory() ) ;
    }


}
